Skip to content

OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration and storage clone and snapshot tests cleanup#16181

Open
cajieh wants to merge 1 commit intoopenshift:mainfrom
cajieh:add-aws-flag-cypress-config
Open

OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration and storage clone and snapshot tests cleanup#16181
cajieh wants to merge 1 commit intoopenshift:mainfrom
cajieh:add-aws-flag-cypress-config

Conversation

@cajieh
Copy link
Contributor

@cajieh cajieh commented Mar 20, 2026

PR Summary

Problem

Missing AWS environment flag - BRIDGE_AWS wasn't passed to Cypress, causing AWS-dependent tests to be skipped in AWS and other platforms.

The snapshot.cy.ts and clone.cy.ts E2E tests were failing due to:

  1. Incorrect URL paths - Snapshot creation form used wrong URL format (snapshot.storage.k8s.iov1VolumeSnapshot instead of volumesnapshots)

  2. Wrong selectors - Used data-test="save-changes" instead of id="save-changes", and non-existent data-test="details-item-value__PVC"

  3. Outdated list selectors - PVC lists now use DataView component (listPage.dvFilter/listPage.dvRows) instead of legacy selectors

  4. Flaky sidebar navigation - Nav items hidden due to collapsed sections causing visibility: hidden errors
    Fragile CLI assertions - cy.exec('oc get pvc...') failed with race conditions
    Fixes
    Cypress config: Added config.env.BRIDGE_AWS = process.env.BRIDGE_AWS to pass AWS flag (config change)

  5. Navigation: Replaced sidebar clicks with direct cy.visit() URLs for reliability
    Selectors: Updated to use correct element selectors and DataView helpers
    Assertions: Removed non-existent data-test attributes and fragile CLI checks

  6. Performance: Moved Ready status wait to restore test where it's actually needed

Justification

  • cy.visit() is more reliable than sidebar navigation which can have hidden elements
  • DataView selectors match the current UI implementation for resource lists
  • Direct URL navigation eliminates dependency on sidebar state between tests
  • Deferring Ready status check to restore test reduces first test runtime from ~2min to 20s while still validating functionality

clone.cy.ts
Screenshot 2026-03-20 at 5 49 22 PM

snapshot.cy.ts
Screenshot 2026-03-20 at 5 47 48 PM

Summary by CodeRabbit

  • Tests
    • Enhanced integration test infrastructure for storage cloning across different storage classes (including GP3 CSI).
    • Improved snapshot creation, listing, and restore test coverage with updated test fixtures and assertions.
    • Added AWS bridge environment support to test configuration.
    • Updated test selectors and navigation strategies for better reliability.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 20, 2026
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-78987, which is invalid:

  • expected the bug to target the "4.22.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

PR Summary

Problem

Missing AWS environment flag - BRIDGE_AWS wasn't passed to Cypress, causing AWS-dependent tests to be skipped in AWS and other platforms.

The snapshot.cy.ts and clone.cy.ts E2E tests were failing due to:

  1. Incorrect URL paths - Snapshot creation form used wrong URL format (snapshot.storage.k8s.iov1VolumeSnapshot instead of volumesnapshots)

  2. Wrong selectors - Used data-test="save-changes" instead of id="save-changes", and non-existent data-test="details-item-value__PVC"

  3. Outdated list selectors - PVC lists now use DataView component (listPage.dvFilter/listPage.dvRows) instead of legacy selectors

  4. Flaky sidebar navigation - Nav items hidden due to collapsed sections causing visibility: hidden errors
    Fragile CLI assertions - cy.exec('oc get pvc...') failed with race conditions
    Fixes
    Cypress config: Added config.env.BRIDGE_AWS = process.env.BRIDGE_AWS to pass AWS flag (config change)

  5. Navigation: Replaced sidebar clicks with direct cy.visit() URLs for reliability
    Selectors: Updated to use correct element selectors and DataView helpers
    Assertions: Removed non-existent data-test attributes and fragile CLI checks

  6. Performance: Moved Ready status wait to restore test where it's actually needed

Justification

  • cy.visit() is more reliable than sidebar navigation which can have hidden elements
  • DataView selectors match the current UI implementation for resource lists
  • Direct URL navigation eliminates dependency on sidebar state between tests
    - Deferring Ready status check to restore test reduces first test runtime from ~2min to 20s while still validating functionality

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from rhamilto and spadgett March 20, 2026 19:38
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added kind/cypress Related to Cypress e2e integration testing approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 20, 2026
@cajieh
Copy link
Contributor Author

cajieh commented Mar 20, 2026

/test e2e-gcp-console

@cajieh cajieh force-pushed the add-aws-flag-cypress-config branch from eb53375 to 603f159 Compare March 20, 2026 20:57
@cajieh cajieh changed the title [WIP] OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration [WIP] OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration and storage clone and snapshot tests cleanup Mar 20, 2026
@cajieh cajieh force-pushed the add-aws-flag-cypress-config branch from 603f159 to 57f2439 Compare March 20, 2026 22:04
@cajieh cajieh changed the title [WIP] OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration and storage clone and snapshot tests cleanup OCPBUGS-78987: Add AWS environment variable flag to Cypress configuration and storage clone and snapshot tests cleanup Mar 20, 2026
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 20, 2026
@cajieh
Copy link
Contributor Author

cajieh commented Mar 23, 2026

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Mar 23, 2026
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-78987, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@cajieh cajieh force-pushed the add-aws-flag-cypress-config branch from 57f2439 to 824b8c9 Compare March 24, 2026 20:24
@openshift-ci-robot
Copy link
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-78987, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

PR Summary

Problem

Missing AWS environment flag - BRIDGE_AWS wasn't passed to Cypress, causing AWS-dependent tests to be skipped in AWS and other platforms.

The snapshot.cy.ts and clone.cy.ts E2E tests were failing due to:

  1. Incorrect URL paths - Snapshot creation form used wrong URL format (snapshot.storage.k8s.iov1VolumeSnapshot instead of volumesnapshots)

  2. Wrong selectors - Used data-test="save-changes" instead of id="save-changes", and non-existent data-test="details-item-value__PVC"

  3. Outdated list selectors - PVC lists now use DataView component (listPage.dvFilter/listPage.dvRows) instead of legacy selectors

  4. Flaky sidebar navigation - Nav items hidden due to collapsed sections causing visibility: hidden errors
    Fragile CLI assertions - cy.exec('oc get pvc...') failed with race conditions
    Fixes
    Cypress config: Added config.env.BRIDGE_AWS = process.env.BRIDGE_AWS to pass AWS flag (config change)

  5. Navigation: Replaced sidebar clicks with direct cy.visit() URLs for reliability
    Selectors: Updated to use correct element selectors and DataView helpers
    Assertions: Removed non-existent data-test attributes and fragile CLI checks

  6. Performance: Moved Ready status wait to restore test where it's actually needed

Justification

  • cy.visit() is more reliable than sidebar navigation which can have hidden elements
  • DataView selectors match the current UI implementation for resource lists
  • Direct URL navigation eliminates dependency on sidebar state between tests
  • Deferring Ready status check to restore test reduces first test runtime from ~2min to 20s while still validating functionality

clone.cy.ts
Screenshot 2026-03-20 at 5 49 22 PM

snapshot.cy.ts
Screenshot 2026-03-20 at 5 47 48 PM

Summary by CodeRabbit

  • Tests
  • Enhanced integration test infrastructure for storage cloning across different storage classes (including GP3 CSI).
  • Improved snapshot creation, listing, and restore test coverage with updated test fixtures and assertions.
  • Added AWS bridge environment support to test configuration.
  • Updated test selectors and navigation strategies for better reliability.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

This change refactors storage integration tests by introducing a new clone test mock module and centralizing naming constants across snapshot and clone fixtures. The clone.ts module exports PVC_NAME, CLONE_NAME, CLONE_SIZE, and a PVCGP3 variant for cross-storage-class testing. Snapshot.ts was restructured to export shared constants, replaced testerDeployment with testerDeploymentWithMounts, and moved PVCGP3 to the clone module. Both clone and snapshot test suites were rewritten to use direct cy.visit navigation instead of sidebar-based routing, adopt dvRows/dvFilter list page objects, and rely on UI-based assertions rather than oc command validation. The snapshot view selector was updated to use a data-test attribute, and BRIDGE_AWS environment variable support was added to the Cypress plugin configuration.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
frontend/packages/integration-tests-cypress/mocks/clone.ts (1)

1-5: Consider importing PVC_NAME from snapshot.ts to avoid duplication.

Both clone.ts and snapshot.ts export PVC_NAME = 'testpvc'. Since you're already importing PVC from snapshot, importing PVC_NAME as well would establish a single source of truth and prevent potential drift.

♻️ Suggested refactor
-import { PVC } from './snapshot';
+import { PVC, PVC_NAME } from './snapshot';

-export const PVC_NAME = 'testpvc';
 export const CLONE_NAME = `${PVC_NAME}-clone`;
 export const CLONE_SIZE = '2';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/integration-tests-cypress/mocks/clone.ts` around lines 1 -
5, Replace the duplicated PVC_NAME constant in clone.ts by importing PVC_NAME
from snapshot.ts (you already import PVC), then use that imported PVC_NAME to
build CLONE_NAME (`CLONE_NAME = `${PVC_NAME}-clone``) and keep CLONE_SIZE as-is;
update the import line to include PVC_NAME and remove the local PVC_NAME
declaration so clone.ts references the single source of truth from snapshot.ts.
frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts (1)

93-119: Consider reducing duplication between clone creation tests.

The "Creates PVC Clone" and "Creates PVC Clone with different storage class" tests share ~80% identical code. While E2E tests often favor explicitness over abstraction, this level of duplication could be reduced with a parameterized helper if test maintenance becomes burdensome. Current approach is acceptable—just flagging for awareness.

♻️ Example parameterized approach
const createCloneTest = (storageClass?: string) => {
  cy.exec(`oc delete pvc ${CLONE_NAME} -n ${testName} --ignore-not-found`, {
    failOnNonZeroExit: false,
  });
  cy.visit(`/k8s/ns/${testName}/core~v1~PersistentVolumeClaim`);
  listPage.dvRows.shouldBeLoaded();
  listPage.dvFilter.byName(PVC_NAME);
  listPage.dvRows.clickKebabAction(PVC_NAME, 'Clone PVC');
  modal.shouldBeOpened();
  modal.submitShouldBeEnabled();
  cy.byTestID('input-request-size').clear().type(CLONE_SIZE);
  if (storageClass) {
    cy.byTestID('storage-class-dropdown').click();
    cy.byTestID('console-select-item').contains(storageClass).click();
  }
  modal.submit();
  modal.shouldBeClosed();
  // ... verification
};

it('Creates PVC Clone', () => createCloneTest());
it('Creates PVC Clone with different storage class', () => createCloneTest('gp3-csi'));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts` around
lines 93 - 119, The two tests duplicate most steps (visiting PVC list, filtering
by PVC_NAME, opening clone modal, setting size, optionally selecting storage
class, submitting and verifying CLONE_NAME) so refactor by extracting a
parameterized helper (e.g., createCloneTest(storageClass?: string)) that
performs the shared flow using symbols from the diff: CLONE_NAME, testName,
PVC_NAME, modal, listPage.dvRows, listPage.dvFilter,
cy.byTestID('input-request-size'), cy.byTestID('storage-class-dropdown') and
DetailsPageSelector for verification; then call it from the two tests (one with
no arg and one with 'gp3-csi') and keep deletePVCClone(...) as-is.
frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts (1)

31-34: Minor inconsistency: before() still uses sidebar navigation.

The test setup uses nav.sidenav.clickNavLink while individual tests use direct cy.visit(). Consider switching to cy.visit() here as well for consistency with the PR's navigation approach. Not blocking, as the current approach still works.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts`
around lines 31 - 34, Replace the sidebar navigation call
nav.sidenav.clickNavLink(['Storage', 'PersistentVolumeClaims']) in the test
setup with a direct cy.visit(...) to the PersistentVolumeClaims list page (the
same URL pattern used by individual tests) so the before() uses the same
navigation method; ensure the visited URL lands on the PVC list such that
listPage.dvRows.shouldBeLoaded() and listPage.dvFilter.byName(PVC_NAME) continue
to work unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts`:
- Around line 64-68: The test uses brittle `.first().click()` selection for PVC
and snapshot class (see cy.byTestID('pvc-dropdown') and
cy.byTestID('snapshot-dropdown') interacting with dropdownFirstItem), which can
pick the wrong item if ordering changes; instead locate and click the specific
option by its visible text or attribute (filter the dropdown items by the
expected name/value and then click that matched element) so the PVC and snapshot
class selections are based on content rather than position.

---

Nitpick comments:
In `@frontend/packages/integration-tests-cypress/mocks/clone.ts`:
- Around line 1-5: Replace the duplicated PVC_NAME constant in clone.ts by
importing PVC_NAME from snapshot.ts (you already import PVC), then use that
imported PVC_NAME to build CLONE_NAME (`CLONE_NAME = `${PVC_NAME}-clone``) and
keep CLONE_SIZE as-is; update the import line to include PVC_NAME and remove the
local PVC_NAME declaration so clone.ts references the single source of truth
from snapshot.ts.

In `@frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts`:
- Around line 93-119: The two tests duplicate most steps (visiting PVC list,
filtering by PVC_NAME, opening clone modal, setting size, optionally selecting
storage class, submitting and verifying CLONE_NAME) so refactor by extracting a
parameterized helper (e.g., createCloneTest(storageClass?: string)) that
performs the shared flow using symbols from the diff: CLONE_NAME, testName,
PVC_NAME, modal, listPage.dvRows, listPage.dvFilter,
cy.byTestID('input-request-size'), cy.byTestID('storage-class-dropdown') and
DetailsPageSelector for verification; then call it from the two tests (one with
no arg and one with 'gp3-csi') and keep deletePVCClone(...) as-is.

In `@frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts`:
- Around line 31-34: Replace the sidebar navigation call
nav.sidenav.clickNavLink(['Storage', 'PersistentVolumeClaims']) in the test
setup with a direct cy.visit(...) to the PersistentVolumeClaims list page (the
same URL pattern used by individual tests) so the before() uses the same
navigation method; ensure the visited URL lands on the PVC list such that
listPage.dvRows.shouldBeLoaded() and listPage.dvFilter.byName(PVC_NAME) continue
to work unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f6fc8ac7-e01d-4738-81f6-e457baa5fbe3

📥 Commits

Reviewing files that changed from the base of the PR and between e0a42f2 and 824b8c9.

📒 Files selected for processing (6)
  • frontend/packages/integration-tests-cypress/mocks/clone.ts
  • frontend/packages/integration-tests-cypress/mocks/snapshot.ts
  • frontend/packages/integration-tests-cypress/plugins/index.js
  • frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts
  • frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts
  • frontend/packages/integration-tests-cypress/views/storage/snapshot.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/integration-tests-cypress/plugins/index.js
  • frontend/packages/integration-tests-cypress/views/storage/snapshot.ts
  • frontend/packages/integration-tests-cypress/mocks/clone.ts
  • frontend/packages/integration-tests-cypress/mocks/snapshot.ts
  • frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts
  • frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts
🧬 Code graph analysis (2)
frontend/packages/integration-tests-cypress/mocks/clone.ts (1)
frontend/packages/integration-tests-cypress/mocks/snapshot.ts (2)
  • PVC_NAME (3-3)
  • PVC (89-104)
frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts (4)
frontend/packages/integration-tests-cypress/views/list-page.ts (1)
  • listPage (3-160)
frontend/packages/integration-tests-cypress/support/index.ts (1)
  • testName (98-101)
frontend/packages/integration-tests-cypress/mocks/snapshot.ts (3)
  • PVC (89-104)
  • testerDeploymentWithMounts (64-87)
  • PVC_NAME (3-3)
frontend/packages/integration-tests-cypress/mocks/clone.ts (4)
  • PVCGP3 (8-23)
  • PVC_NAME (3-3)
  • CLONE_NAME (4-4)
  • CLONE_SIZE (5-5)
🔇 Additional comments (14)
frontend/packages/integration-tests-cypress/plugins/index.js (1)

69-69: LGTM!

Clean addition following the established pattern for environment variable passthrough. This unblocks AWS-dependent tests without introducing any security or architectural concerns.

frontend/packages/integration-tests-cypress/views/storage/snapshot.ts (1)

8-8: LGTM!

Excellent improvement switching to data-test attribute selector. This decouples test stability from CSS class changes and aligns with console's testing conventions for resilient E2E selectors.

frontend/packages/integration-tests-cypress/mocks/clone.ts (1)

7-23: LGTM!

Clean composition reusing PVC properties while explicitly setting the different storage class. The JSDoc comment clarifies the test purpose well.

frontend/packages/integration-tests-cypress/mocks/snapshot.ts (3)

3-5: LGTM!

Good consolidation of naming constants. The derived SNAPSHOT_NAME and reference to DEPLOYMENT_NAME establish clear, maintainable naming conventions for the test fixtures.


63-87: LGTM with minor note.

The volumeMounts approach is correct for filesystem-backed PVCs. The simplified spec (no nodeSelector/strategy overrides) is cleaner for test environments.

One small observation: the JSDoc says "for clone tests" but snapshot.cy.ts also uses this deployment. Consider updating to "for storage tests requiring filesystem mounts" or similar.


116-124: LGTM!

Using the template string ensures the restore PVC name stays synchronized with SNAPSHOT_NAME. Good maintainability improvement.

frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts (4)

1-20: LGTM!

Clean imports with centralized constants. The AWS gating with String(...).toLowerCase() === 'true' is defensive and handles edge cases well. Good inline documentation of platform requirements.


41-58: LGTM!

Robust cleanup with failOnNonZeroExit: false ensures test suite doesn't fail due to already-deleted resources. The --ignore-not-found flag provides additional clarity of intent. Good defensive test teardown.


87-109: LGTM with design note.

Good performance optimization moving the Ready status wait (120s) here from the create test. The approach of navigating to details first ensures the snapshot exists before attempting restore. The deployment patch to trigger Bound status is a solid verification approach.

Minor observation: the test navigates to details, waits for Ready, then navigates back to list to trigger restore via kebab. If the details page has a restore action, that could eliminate one navigation. Not blocking—current flow is clear and works.


81-85: LGTM!

Clean list and delete tests using consistent dvRows API. Direct URL navigation and proper modal interaction/verification.

Also applies to: 111-120

frontend/packages/integration-tests-cypress/tests/storage/clone.cy.ts (4)

10-20: LGTM!

Good extraction of the delete workflow into a reusable helper. Clean parameterization and proper use of dvRows API with modal verification.


27-59: LGTM!

Consistent setup/teardown pattern with snapshot.cy.ts. Defensive cleanup with failOnNonZeroExit: false ensures clean state regardless of test outcomes.


61-91: LGTM!

Good test isolation with pre-cleanup of leftover clones. Direct navigation and dvRows API usage is consistent throughout. The 60s timeout for details page loading is appropriate for CI environments.


121-125: LGTM!

Clear skip message indicating platform requirements when tests can't run.

Comment on lines +64 to +68
cy.byTestID('pvc-dropdown', { timeout: 60000 }).should('be.visible').click();
cy.get(dropdownFirstItem, { timeout: 60000 }).should('be.visible').first().click();
// Wait for snapshot class dropdown to be ready and select snapshot class
cy.byTestID('snapshot-dropdown', { timeout: 60000 }).should('be.visible').click();
cy.get(dropdownFirstItem, { timeout: 60000 }).should('be.visible').first().click();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fragile dropdown selection: .first().click() assumes ordering.

Using .first() on dropdown items relies on a specific item ordering. If the dropdown contents change or load in different order, the test could select the wrong PVC or snapshot class. Consider filtering by expected name/value for more reliable selection.

🛡️ More resilient selection example
-      cy.get(dropdownFirstItem, { timeout: 60000 }).should('be.visible').first().click();
+      cy.get(dropdownFirstItem, { timeout: 60000 }).contains(PVC_NAME).click();

Similarly for snapshot class selection, if a specific class is expected.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/packages/integration-tests-cypress/tests/storage/snapshot.cy.ts`
around lines 64 - 68, The test uses brittle `.first().click()` selection for PVC
and snapshot class (see cy.byTestID('pvc-dropdown') and
cy.byTestID('snapshot-dropdown') interacting with dropdownFirstItem), which can
pick the wrong item if ordering changes; instead locate and click the specific
option by its visible text or attribute (filter the dropdown items by the
expected name/value and then click that matched element) so the PVC and snapshot
class selections are based on content rather than position.

@cajieh
Copy link
Contributor Author

cajieh commented Mar 25, 2026

/test e2e-gcp-console

Comment on lines +1 to +3
import { PVC } from './snapshot';

export const PVC_NAME = 'testpvc';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { PVC } from './snapshot';
export const PVC_NAME = 'testpvc';
import { PVC, PVC_NAME } from './snapshot';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally scoped the const to this test to avoid cross-importing mocks, but a shared mock file would probably be cleaner.

export const SNAPSHOT_NAME = `${PVC_NAME}-snapshot`;
export const DEPLOYMENT_NAME = 'busybox-deployment';

export const testerDeployment = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If testerDeployment is no longer used, it can be removed

Comment on lines 2 to 4
@@ -5,4 +5,4 @@ export namespace SnapshotDetails {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 2-4 If no longer used, can be removed

@@ -1,36 +1,40 @@
import { PVC, PVCGP3, testerDeployment } from '../../mocks/snapshot';
import { PVC_NAME, CLONE_NAME, CLONE_SIZE, PVCGP3 } from '../../mocks/clone';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { PVC_NAME, CLONE_NAME, CLONE_SIZE, PVCGP3 } from '../../mocks/clone';
import { PVC_NAME, PVC, CLONE_NAME, CLONE_SIZE, PVCGP3 } from '../../mocks/clone';

@cajieh
Copy link
Contributor Author

cajieh commented Mar 26, 2026

/test e2e-gcp-console

@cajieh cajieh force-pushed the add-aws-flag-cypress-config branch from 824b8c9 to 5bde779 Compare March 26, 2026 20:47
@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Mar 26, 2026
@cajieh cajieh force-pushed the add-aws-flag-cypress-config branch from 5bde779 to 12a5820 Compare March 26, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants